﻿using System.Net;
using System.Net.Mail;
using System.Text;
using System.Security.Cryptography;

namespace eVoting
{
    public class Utilities
    {

        public static void sendMail(string address, string message)
        {
            SmtpClient ss = new SmtpClient("smtp.gmail.com", 587);
            ss.UseDefaultCredentials = false;
            ss.Credentials = new NetworkCredential("guc.su.evoting@gmail.com", "gucevoting123");
            ss.EnableSsl = true;
            //ss.Timeout = 10000;
            ss.DeliveryMethod = SmtpDeliveryMethod.Network;
            MailAddress maf = new MailAddress("guc.su.evoting@gmail.com", "GUC-Student Union eVoting");
            MailMessage mm = new MailMessage(maf, new MailAddress(address));
            mm.Subject = "Your poll vote";
            mm.Body = message;

            mm.BodyEncoding = UTF8Encoding.UTF8;
            mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
            ss.Send(mm);

        }

    }
}